#pragma once

namespace UTIL {

/**
 * Logger
 */
class CLogger
{
public:
	CLogger(LPCSTR prefix = NULL);

	void log(LPCSTR message) const;
	void log(LPCOLESTR message) const;
	void log(LPCSTR format, DWORD dwValue) const;
	void log(LPCSTR format, DWORD dwValue, DWORD dwValue2) const;
	void log(LPCOLESTR format, DWORD dwValue) const;
	void log(LPCSTR message, LPCSTR text) const;
	void log(LPCSTR message, LPCOLESTR text) const;
	void log(LPCOLESTR message, LPCOLESTR text) const;
	void log(LPCSTR prefix, LPCSTR message, LPCSTR text) const;

	void log(LPCSTR format, void* pValue) const
	{
		log(format, (DWORD)pValue);
	}

	bool IsLogEnabled() const
	{
		return m_bLogEnabled;
	}

    void Debug(LPCSTR message)  const;
    void Debug(LPCOLESTR message)  const;
    void Warn(LPCSTR message)  const;
    void Warn(LPCOLESTR message)  const;
    void Error(LPCSTR message)  const;
    void Error(LPCOLESTR message)  const;

    void SetPrefix(LPCSTR prefix);

private:
	char  m_prefix[64];
	bool  m_bLogEnabled;
	TCHAR m_file[MAX_PATH+64];
};

#ifdef _USE_LOGGING
	#define LOG logger.log
#else
	#define LOG __noop
#endif

#define DEFINE_LOGGER(class_name) CLogger class_name::logger(#class_name);

}; //namespace UTIL
